<template>
	<view @click="navToForm" class="ruzhu-btn">
		<lfd-touch-menu :xOffset="initX" :yOffset="initY" :wtop="top" :wbottom="bottom" :icon="$getCloudStorageUrl('/tenants.png')" :wmenuSize="150" stoprefresh mode="rb"></lfd-touch-menu>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				top: 0,
				bottom: 0
			};
		},
		props: {
			excludeTabBar: {
				type: Boolean,
				default: false
			},
			excludeNavBar: {
				type: Boolean,
				default: true
			},
			botOffset: {
				type: Number,
				default: 0
			},
			initX: {
				type: Number,
				default: 0
			},
			initY: {
				type: Number,
				default: 0
			}
		},
		mounted() {
			// console.log('ruzhubtn mounted', this.initY)
		},
		created() {
			// console.log('ruzhubtn created', this.initY)
			let sysInfo = uni.getSystemInfoSync();
			// #ifdef H5
			if (this.excludeTabBar) {
				this.bottom = 100;
			}
			if (this.excludeNavBar) {
				this.top = 88;
			}
			// #endif
			// #ifdef MP
			if (this.excludeNavBar) {
				let rect = uni.getMenuButtonBoundingClientRect();
				let navH = (rect.top - sysInfo.statusBarHeight) * 2 + rect.height;
				this.top = (navH + sysInfo.statusBarHeight) * 750 / sysInfo.windowWidth;
			}
			// #endif
			this.bottom += sysInfo.safeAreaInsets.bottom
			this.bottom += this.botOffset
		},
		updated() {
			console.log('ruzhu button updated')
		},
		methods: {
			navToForm() {
				uni.navigateTo({
					url: "/pagesGroup/platform/join-us-form"
				})
			},
		}
	}
</script>

<style lang="scss">
	.ruzhu-btn {
		position: absolute;
		z-index: 9999;
	}
</style>
